/*
 * DeleteSelectedElementMouseListener.cpp
 *
 *  Created on: 15-01-2011
 *      Author: Przemek
 */

#include "listener/DeleteSelectedElementMouseListener.hpp"
#include "world/World.hpp"

DeleteSelectedElementMouseListener::DeleteSelectedElementMouseListener(
		SelectElementMouseListener* selectElementMouseListener) :
	selectElementMouseListener(selectElementMouseListener)
{

}

void DeleteSelectedElementMouseListener::mouseReleased(const MouseListener::EventArguments&)
{
	if(selectElementMouseListener->anySelected())
	{
		World::getInstance().remove(selectElementMouseListener->getSelected());
		selectElementMouseListener->clearSelection();
	}
}

